package cn.jiadakeji.parent.common.domian;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: heYanFeng
 * @Date: 2022/02/10/16:21
 * @Description:
 */

import cn.jiadakeji.parent.common.util.Md5Utils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 微信调起支付数据 WxPayment
 *
 * @author weijian
 */

@ApiModel(value="WxPayment",description="微信调起支付数据")
public class WxPayment
{
    @ApiModelProperty(value="wxTradeId", required = true)
   // @Excel(name = "wxTradeId")
    private Long wxTradeId;

    @ApiModelProperty(value="小程序id", required = true)
   // @Excel(name = "小程序id")
    private String appId;

    @ApiModelProperty(value="时间戳", required = true)
  //  @Excel(name = "时间戳")
    private String timeStamp;

    @ApiModelProperty(value="随机字符串", required = true)
    //@Excel(name = "随机字符串")
    private String nonceStr;

    @ApiModelProperty(value="订单详情扩展字符串", required = true)
    //@Excel(name = "订单详情扩展字符串")
    private String _package;

    @ApiModelProperty(value="签名方式", required = true)
   // @Excel(name = "签名方式")
    private String signType;

    @ApiModelProperty(value="签名", required = true)
   // @Excel(name = "签名")
    private String paySign;

    public void sign(String key){
        String sign = ("appId="+appId+"&");
        sign += ("nonceStr="+nonceStr+"&");
        sign += ("package="+_package+"&");
        sign += ("signType="+signType+"&");
        sign += ("timeStamp="+timeStamp+"&");
        sign += ("key="+key);
        System.out.println("sign="+sign);
        setPaySign(Md5Utils.MD5(sign).toUpperCase());
    }

    public Long getWxTradeId() {
        return wxTradeId;
    }

    public void setWxTradeId(Long wxTradeId) {
        this.wxTradeId = wxTradeId;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(String timeStamp) {
        this.timeStamp = timeStamp;
    }

    public String getNonceStr() {
        return nonceStr;
    }

    public void setNonceStr(String nonceStr) {
        this.nonceStr = nonceStr;
    }

    public String get_package() {
        return _package;
    }

    public void set_package(String _package) {
        this._package = _package;
    }

    public String getSignType() {
        return signType;
    }

    public void setSignType(String signType) {
        this.signType = signType;
    }

    public String getPaySign() {
        return paySign;
    }

    public void setPaySign(String paySign) {
        this.paySign = paySign;
    }

    @Override
    public String toString() {
        return "WxPayment{" +
                "wxTradeId=" + wxTradeId +
                ", appId='" + appId + '\'' +
                ", timeStamp='" + timeStamp + '\'' +
                ", nonceStr='" + nonceStr + '\'' +
                ", _package='" + _package + '\'' +
                ", signType='" + signType + '\'' +
                ", paySign='" + paySign + '\'' +
                '}';
    }
}

